package com.ming.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ming.domain.SysLog;
import com.ming.sevice.SysLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:何元才
 * @Desc:
 * @data:2021-03-31 21:28
 */
@RestController
@Api(value = "系统日志管理接口")
@RequestMapping("sys/log")
public class SysLogController {

    @Autowired
    private SysLogService sysLogService;

    /**
     * 分页查询日志
     *
     * @param page
     * @param sysLog
     * @return
     */
    @GetMapping("page")
    @ApiOperation("分页查询日志")
    @PreAuthorize("hasAuthority('sys:log:page')")
    public ResponseEntity<Page<SysLog>> sysLogPage(Page<SysLog> page, SysLog sysLog){
        Page<SysLog> sysLogPage = sysLogService.findSysLogPage(page,sysLog);
        return ResponseEntity.ok(sysLogPage);
    }
}
